﻿@using FwProject.Settlement.Dto
@model List<SettlementInfoDto>
@{
    Layout = null;
    decimal sumActualprice = 0m;
    decimal sumAlreadyPrice = 0m;
    decimal sumUncollected = 0m;
}
<div class="modal-dialog" style="width:800px;">
    <div class="modal-content animated fadeIn">
        <form class="form-horizontal">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">选择销售单据</h4>
            </div>
            <div class="modal-body">
                <table id="t" class="table table-bordered table-hover table-rowselected">
                    <thead>
                        <tr>
                            <th style="text-align:center;width: 40px;">
                                <div class="i-checks" id="chkDiv">
                                    <label class="ibox-tools" id="latd1">
                                        <input type="checkbox" id="che" value="">
                                    </label>
                                </div>
                            </th>
                            <th>单据类型</th>
                            <th>单据编号</th>
                            <th>单据日期</th>
                            <th>配送日期</th>
                            <th>应收金额</th>
                            <th>已收金额</th>
                            <th>未收金额</th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (Model.Count == 0)
                        {
                            <tr><td colspan="8" align="center">暂无数据</td></tr>
                        }
                        else
                        {
                            foreach (var item in Model)
                            {
                                <tr>
                                    <td style="text-align:center">
                                        <div class="i-checks" data-value="@item.Id">
                                            <input type="checkbox" name="che" value="@item.Id"> <i></i>
                                        </div>
                                    </td>
                                    <td><input type="hidden" name="BalanceWayEnum" value="@item.BalanceWayEnum" />@item.BalanceWayEnum</td>
                                    <td><input type="hidden" name="CreationNumber" value="@item.CreationNumber" />@item.CreationNumber</td>
                                    <td><input type="hidden" name="CreationTime" value="@item.CreationTime.ToString("yyyy-MM-dd")" />@item.CreationTime.ToString("yyyy-MM-dd")</td>
                                    <td><input type="hidden" name="DeliveryDate" value="@item.DeliveryDate" />@item.DeliveryDate</td>
                                    <td><input type="hidden" name="Actualprice" value="@item.Actualprice" />@item.Actualprice</td>
                                    <td><input type="hidden" name="RemarksConten" value="@item.RemarksConten" />@item.AlreadyPrice</td>
                                    <td><input type="hidden" name="Uncollected" value="@(item.Actualprice - item.AlreadyPrice)" />@(item.Actualprice - item.AlreadyPrice)</td>
                                </tr>
                                sumActualprice += item.Actualprice;
                                sumAlreadyPrice += item.AlreadyPrice;
                                sumUncollected += (item.Actualprice - item.AlreadyPrice);
                            }
                            <tr class="footer">
                                <td colspan="2">合计</td>
                                <td colspan="3"></td>
                                <td>@sumActualprice</td>
                                <td>@sumAlreadyPrice</td>
                                <td>@sumUncollected</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="reset" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="save" class="btn btn-primary" data-loading-text="执行中...">保存</button>
            </div>
        </form>
    </div>
    <!-- /.modal-content -->
</div>




